/**
 * Created by Administrator on 2016/3/29.
 */
var isLoginData=false;
var session={
    isLogin:false,
    data:{}
};

export var isLogin=()=>{
    return isLoginData;
};

export var getSession=()=>{
    var local=localStorage.getItem('user_session');
    if(local){
        session=JSON.parse(local);
    }
    return Object.assign({},session.data);
};

export var setSession=(newSession)=>{
    Object.assign(session.data,newSession);
    isLoginData=true;
    localStorage.setItem('user_session',JSON.stringify(session));
};

export var clearSession=()=>{
    session.isLogin=false;
    session.data={};
}